BEGIN {Ext="awk"}
/#12345/ { getline; getline; file=$0; 
	       getline; split($0,tmp," "); 
		   area=tmp[1];  
		   dirExists("out/" area)
		   path="out/"area"/"file"." Ext; 
		   print file> path; 
		   $0 = $0" Revised"
	     }
path     { print $0 >> path }

function dirExists(d) {
	system("[ ! -d \"" d "\" ] && mkdir -p " d)
}
